jQuery.fn.resizable = function(options) {
	var settings = jQuery.extend({
		value: 5, name: "pete", bar: 655
	}, options);
	
	var element = this, startX, startY, active = false;
	//alert(element.css("width"));
	//alert(this.attr("id"));
	this.mousedown(function(e){
		if (!e.shiftKey) return;
		//alert("start");
		active = true;
		
		pX = element.offset().left;
		pY = element.offset().top;
		
		dX = e.pageX - pX;
		dY = e.pageY - pY;
		
		orgWidth = parseInt(element.css("width"));
		orgHeight = parseInt(element.css("height"));
		
		//alert(dX + " " + dY + " " + orgWidth +" "+ orgHeight);
		
		element.bind("mousemove.resize", function(e){
			
			dX1 = e.pageX - pX;
			dY1 = e.pageY - pY;
			
			if (dX1 < 5) dX1 = 5;
			if (dY1 < 5) dY1 = 5;
			
			newW = orgWidth * dX1 / dX;
			newH = orgHeight * dY1 / dY;
			
			$("p#message").html(newW + " x " + newH);
			
			element.css("width", newW + "px");
			element.css("height", newH + "px");
		})
	});
	
	this.mouseup(function(){
		if (!active) return;
		
		active = false;
		element.unbind("mousemove.resize");
	});
};